package case1.duck;

import case1.Quackable;
import case1.core.observer.Observable;
import case1.core.observer.Observer;

/**
 * @author yuanml
 */
public class MallardDuck implements Quackable {
    private final Observable observable;

    public MallardDuck() {
        observable = new Observable(this);
    }

    @Override
    public void quack() {
        System.out.println("Quack");
        notifyObserver();
    }

    @Override
    public void registerObserver(Observer observer) {
        observable.registerObserver(observer);
    }

    @Override
    public void notifyObserver() {
        observable.notifyObserver();
    }
}
